home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8494 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  746 b 

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: strange behaviour of doubles
  5. Date: 4 Mar 1996 10:34:22 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4hfd3eINNt50@keats.ugrad.cs.ubc.ca>
  8. References: <1996Mar4.014052.6236@dcs.warwick.ac.uk>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <1996Mar4.014052.6236@dcs.warwick.ac.uk>,
  12. Daniel Castillo Molero <D.C.Molero@dcs.warwick.ac.uk> wrote:
  13.  >  scanf("%g", &y);
  14.  >  printf("%g %g\n", x, y);
  15.  >  scanf("%g", &x);
  16.  
  17. You are lying to scanf(). You tell it to expect two float pointers, and then
  18. feed it pointers to double.
  19.  
  20. Change that to "%lg" and you should be ok.
  21. -- 
  22.  
  23.